import {PlanetTypeItem} from "./Type.ts";

let planetTypeItemData: Array<PlanetTypeItem> = []

let planetTypeItemMap = new Map<number, PlanetTypeItem>()

export let loadPlanetTypeItemData = (): Array<PlanetTypeItem> => {
    if (planetTypeItemData.length > 0) {
        return [...planetTypeItemData]
    }
    for (let i of defaultData) {
        planetTypeItemData.push(Object.assign(new PlanetTypeItem(), i))
    }
    return [...planetTypeItemData]
}

export let loadPlanetTypeItemMap = (): Map<number, PlanetTypeItem> => {
    if (planetTypeItemMap.size > 0) {
        return new Map(planetTypeItemMap)
    }
    for (let planetTypeItem of loadPlanetTypeItemData()) {
        planetTypeItemMap.set(planetTypeItem.id, planetTypeItem)
    }
    return new Map(planetTypeItemMap)
}

export let defaultData = [
    {
        id: 1,
        planetTypeId: 1,
        itemId: 1001,
        percent: 1,
        count: 7200000
    }, {
        id: 2,
        planetTypeId: 1,
        itemId: 1002,
        percent: 1,
        count: 3600000
    }, {
        id: 3,
        planetTypeId: 1,
        itemId: 1005,
        percent: 1,
        count: 13600000
    }, {
        id: 4,
        planetTypeId: 1,
        itemId: 1006,
        percent: 1,
        count: 26600000
    }, {
        id: 5,
        planetTypeId: 1,
        itemId: 1117,
        percent: 1.0,
        count: 1100000
    }, {
        id: 6,
        planetTypeId: 1,
        itemId: 1007,
        percent: 1.0,
        count: 1100,
        recover: 11
    }, {
        id: 7,
        planetTypeId: 2,
        itemId: 1001,
        percent: 1,
        count: 2200000
    }, {
        id: 8,
        planetTypeId: 2,
        itemId: 1002,
        percent: 1,
        count: 14500000
    }, {
        id: 9,
        planetTypeId: 2,
        itemId: 1004,
        percent: 1,
        count: 14500000
    }, {
        id: 10,
        planetTypeId: 2,
        itemId: 1005,
        percent: 1,
        count: 24200000
    }, {
        id: 11,
        planetTypeId: 2,
        itemId: 1006,
        percent: 1,
        count: 200000
    }, {
        id: 12,
        planetTypeId: 2,
        itemId: 1012,
        percent: 0.18,
        count: 800000
    }, {
        id: 13,
        planetTypeId: 3,
        itemId: 1001,
        percent: 1,
        count: 1020000
    }, {
        id: 14,
        planetTypeId: 3,
        itemId: 1002,
        percent: 1,
        count: 15000000
    }, {
        id: 15,
        planetTypeId: 3,
        itemId: 1003,
        percent: 1,
        count: 1690000
    }, {
        id: 16,
        planetTypeId: 3,
        itemId: 1004,
        percent: 1,
        count: 7300000
    }, {
        id: 17,
        planetTypeId: 3,
        itemId: 1005,
        percent: 1,
        count: 680000
    }, {
        id: 18,
        planetTypeId: 3,
        itemId: 1006,
        percent: 1,
        count: 200000
    }, {
        id: 19,
        planetTypeId: 3,
        itemId: 1007,
        percent: 0.5,
        count: 6000000
    }, {
        id: 20,
        planetTypeId: 3,
        itemId: 1013,
        percent: 0.3,
        count: 3300000
    }, {
        id: 21,
        planetTypeId: 4,
        itemId: 1001,
        percent: 1,
        count: 6000000
    }, {
        id: 22,
        planetTypeId: 4,
        itemId: 1002,
        percent: 1,
        count: 900000
    }, {
        id: 23,
        planetTypeId: 4,
        itemId: 1003,
        percent: 1,
        count: 15800000
    }, {
        id: 24,
        planetTypeId: 4,
        itemId: 1005,
        percent: 1,
        count: 3900000
    }, {
        id: 25,
        planetTypeId: 4,
        itemId: 1006,
        percent: 1,
        count: 24200000
    }, {
        id: 26,
        planetTypeId: 4,
        itemId: 1117,
        percent: 1.0,
        count: 12300000
    }, {
        id: 27,
        planetTypeId: 4,
        itemId: 1015,
        percent: 0.5,
        count: 600000
    }, {
        id: 28,
        planetTypeId: 4,
        itemId: 1007,
        percent: 1.0,
        count: 12300,
        recover: 123
    }, {
        id: 29,
        planetTypeId: 5,
        itemId: 1001,
        percent: 1,
        count: 36300000
    }, {
        id: 30,
        planetTypeId: 5,
        itemId: 1002,
        percent: 1,
        count: 36300000
    }, {
        id: 31,
        planetTypeId: 5,
        itemId: 1003,
        percent: 1,
        count: 1700000
    }, {
        id: 32,
        planetTypeId: 5,
        itemId: 1004,
        percent: 1,
        count: 21800000
    }, {
        id: 33,
        planetTypeId: 5,
        itemId: 1005,
        percent: 1,
        count: 2900000
    }, {
        id: 34,
        planetTypeId: 5,
        itemId: 1006,
        percent: 1,
        count: 400000
    }, {
        id: 35,
        planetTypeId: 5,
        itemId: 1012,
        percent: 0.2,
        count: 10400000
    }, {
        id: 36,
        planetTypeId: 5,
        itemId: 1013,
        percent: 0.2,
        count: 10400000
    }, {
        id: 37,
        planetTypeId: 6,
        itemId: 1001,
        percent: 1,
        count: 7200000
    }, {
        id: 38,
        planetTypeId: 6,
        itemId: 1002,
        percent: 1,
        count: 200000
    }, {
        id: 39,
        planetTypeId: 6,
        itemId: 1003,
        percent: 1,
        count: 5800000
    }, {
        id: 40,
        planetTypeId: 6,
        itemId: 1004,
        percent: 1,
        count: 24200000
    }, {
        id: 41,
        planetTypeId: 6,
        itemId: 1005,
        percent: 1,
        count: 3900000
    }, {
        id: 42,
        planetTypeId: 6,
        itemId: 1006,
        percent: 1,
        count: 100000
    }, {
        id: 43,
        planetTypeId: 6,
        itemId: 1007,
        percent: 1.0,
        count: 26900000
    }, {
        id: 44,
        planetTypeId: 6,
        itemId: 1013,
        percent: 0.2,
        count: 3300000
    }, {
        id: 45,
        planetTypeId: 7,
        itemId: 1001,
        percent: 1,
        count: 2200000
    }, {
        id: 46,
        planetTypeId: 7,
        itemId: 1002,
        percent: 1,
        count: 2200000
    }, {
        id: 47,
        planetTypeId: 7,
        itemId: 1003,
        percent: 1,
        count: 3300000
    }, {
        id: 48,
        planetTypeId: 7,
        itemId: 1004,
        percent: 1,
        count: 13100000
    }, {
        id: 49,
        planetTypeId: 7,
        itemId: 1005,
        percent: 1,
        count: 52500000
    }, {
        id: 50,
        planetTypeId: 7,
        itemId: 1007,
        percent: 0.5,
        count: 7500000
    }, {
        id: 51,
        planetTypeId: 7,
        itemId: 1012,
        percent: 0.2,
        count: 10400000
    }, {
        id: 52,
        planetTypeId: 8,
        itemId: 1001,
        percent: 1,
        count: 1500000
    }, {
        id: 53,
        planetTypeId: 8,
        itemId: 1002,
        percent: 1,
        count: 16900000
    }, {
        id: 54,
        planetTypeId: 8,
        itemId: 1003,
        percent: 1,
        count: 19400000
    }, {
        id: 55,
        planetTypeId: 8,
        itemId: 1005,
        percent: 1,
        count: 16900000
    }, {
        id: 56,
        planetTypeId: 8,
        itemId: 1006,
        percent: 1,
        count: 3600000
    }, {
        id: 57,
        planetTypeId: 8,
        itemId: 1012,
        percent: 0.25,
        count: 7500000
    }, {
        id: 58,
        planetTypeId: 8,
        itemId: 1013,
        percent: 0.25,
        count: 7500000
    }, {
        id: 59,
        planetTypeId: 9,
        itemId: 1001,
        percent: 1,
        count: 24200000
    }, {
        id: 60,
        planetTypeId: 9,
        itemId: 1002,
        percent: 1,
        count: 24200000
    }, {
        id: 61,
        planetTypeId: 9,
        itemId: 1003,
        percent: 1,
        count: 1700000
    }, {
        id: 62,
        planetTypeId: 9,
        itemId: 1004,
        percent: 1,
        count: 16900000
    }, {
        id: 63,
        planetTypeId: 9,
        itemId: 1005,
        percent: 1,
        count: 2900000
    }, {
        id: 64,
        planetTypeId: 9,
        itemId: 1006,
        percent: 1,
        count: 3600000
    }, {
        id: 65,
        planetTypeId: 10,
        itemId: 1001,
        percent: 1,
        count: 3400000
    }, {
        id: 66,
        planetTypeId: 10,
        itemId: 1002,
        percent: 1,
        count: 6100000
    }, {
        id: 67,
        planetTypeId: 10,
        itemId: 1005,
        percent: 1,
        count: 19400000
    }, {
        id: 68,
        planetTypeId: 10,
        itemId: 1006,
        percent: 1,
        count: 19400000
    }, {
        id: 69,
        planetTypeId: 10,
        itemId: 1012,
        percent: 0.4,
        count: 3100000
    }, {
        id: 70,
        planetTypeId: 10,
        itemId: 1117,
        percent: 1.0,
        count: 7900000
    }, {
        id: 71,
        planetTypeId: 10,
        itemId: 1015,
        percent: 0.5,
        count: 2400000
    }, {
        id: 72,
        planetTypeId: 10,
        itemId: 1007,
        percent: 1.0,
        count: 7900,
        recover: 79
    }, {
        id: 73,
        planetTypeId: 11,
        itemId: 1001,
        percent: 1,
        count: 7200000
    }, {
        id: 74,
        planetTypeId: 11,
        itemId: 1002,
        percent: 1,
        count: 2900000
    }, {
        id: 75,
        planetTypeId: 11,
        itemId: 1003,
        percent: 1,
        count: 7200000
    }, {
        id: 76,
        planetTypeId: 11,
        itemId: 1004,
        percent: 1,
        count: 500000
    }, {
        id: 77,
        planetTypeId: 11,
        itemId: 1005,
        percent: 1,
        count: 1700000
    }, {
        id: 78,
        planetTypeId: 11,
        itemId: 1006,
        percent: 1,
        count: 16900000
    }, {
        id: 79,
        planetTypeId: 11,
        itemId: 1117,
        percent: 1.0,
        count: 12300000
    }, {
        id: 80,
        planetTypeId: 11,
        itemId: 1015,
        percent: 0.5,
        count: 9400000
    }, {
        id: 81,
        planetTypeId: 11,
        itemId: 1007,
        percent: 1.0,
        count: 12300,
        recover: 123
    }, {
        id: 82,
        planetTypeId: 12,
        itemId: 1006,
        percent: 1,
        count: 1900000
    }, {
        id: 83,
        planetTypeId: 12,
        itemId: 1015,
        percent: 1.0,
        count: 11600000
    }, {
        id: 84,
        planetTypeId: 13,
        itemId: 1001,
        percent: 1,
        count: 2900000
    }, {
        id: 85,
        planetTypeId: 13,
        itemId: 1002,
        percent: 1,
        count: 9200000
    }, {
        id: 86,
        planetTypeId: 13,
        itemId: 1003,
        percent: 1,
        count: 17300000
    }, {
        id: 87,
        planetTypeId: 13,
        itemId: 1004,
        percent: 1,
        count: 2400000
    }, {
        id: 88,
        planetTypeId: 13,
        itemId: 1005,
        percent: 1,
        count: 2600000
    }, {
        id: 89,
        planetTypeId: 13,
        itemId: 1006,
        percent: 1,
        count: 200000
    }, {
        id: 90,
        planetTypeId: 13,
        itemId: 1012,
        percent: 0.7,
        count: 6000000
    }, {
        id: 91,
        planetTypeId: 13,
        itemId: 1014,
        percent: 0.1,
        count: 3300000
    }, {
        id: 92,
        planetTypeId: 14,
        itemId: 1001,
        percent: 1,
        count: 4300000
    }, {
        id: 93,
        planetTypeId: 14,
        itemId: 1002,
        percent: 1,
        count: 4400000
    }, {
        id: 94,
        planetTypeId: 14,
        itemId: 1003,
        percent: 1,
        count: 9200000
    }, {
        id: 95,
        planetTypeId: 14,
        itemId: 1005,
        percent: 1,
        count: 3900000
    }, {
        id: 96,
        planetTypeId: 14,
        itemId: 1006,
        percent: 1,
        count: 19400000
    }, {
        id: 97,
        planetTypeId: 14,
        itemId: 1117,
        percent: 1.0,
        count: 12300000
    }, {
        id: 98,
        planetTypeId: 14,
        itemId: 1015,
        percent: 1,
        count: 6000000
    }, {
        id: 99,
        planetTypeId: 14,
        itemId: 1007,
        percent: 1.0,
        count: 12300,
        recover: 123
    }, {
        id: 100,
        planetTypeId: 15,
        itemId: 1001,
        percent: 1,
        count: 2900000
    }, {
        id: 101,
        planetTypeId: 15,
        itemId: 1002,
        percent: 1,
        count: 15500000
    }, {
        id: 102,
        planetTypeId: 15,
        itemId: 1003,
        percent: 1,
        count: 4800000
    }, {
        id: 103,
        planetTypeId: 15,
        itemId: 1004,
        percent: 1,
        count: 13600000
    }, {
        id: 104,
        planetTypeId: 15,
        itemId: 1005,
        percent: 1,
        count: 2600000
    }, {
        id: 105,
        planetTypeId: 15,
        itemId: 1006,
        percent: 1,
        count: 200000
    }, {
        id: 106,
        planetTypeId: 15,
        itemId: 1012,
        percent: 0.25,
        count: 7500000
    }, {
        id: 107,
        planetTypeId: 15,
        itemId: 1013,
        percent: 0.25,
        count: 7500000
    }, {
        id: 108,
        planetTypeId: 15,
        itemId: 1014,
        percent: 0.4,
        count: 3100000
    }, {
        id: 109,
        planetTypeId: 16,
        itemId: 1001,
        percent: 1,
        count: 9600000
    }, {
        id: 110,
        planetTypeId: 16,
        itemId: 1002,
        percent: 1,
        count: 26600000
    }, {
        id: 111,
        planetTypeId: 16,
        itemId: 1003,
        percent: 1,
        count: 1200000
    }, {
        id: 112,
        planetTypeId: 16,
        itemId: 1004,
        percent: 1,
        count: 19400000
    }, {
        id: 113,
        planetTypeId: 16,
        itemId: 1005,
        percent: 1,
        count: 2600000
    }, {
        id: 114,
        planetTypeId: 16,
        itemId: 1006,
        percent: 1,
        count: 200000
    }, {
        id: 115,
        planetTypeId: 16,
        itemId: 1007,
        percent: 1.0,
        count: 7500000
    }, {
        id: 116,
        planetTypeId: 16,
        itemId: 1012,
        percent: 0.2,
        count: 10400000
    }, {
        id: 117,
        planetTypeId: 16,
        itemId: 1014,
        percent: 0.15,
        count: 2400000
    }, {
        id: 118,
        planetTypeId: 17,
        itemId: 1001,
        percent: 1,
        count: 8400000
    }, {
        id: 119,
        planetTypeId: 17,
        itemId: 1002,
        percent: 1,
        count: 3400000
    }, {
        id: 120,
        planetTypeId: 17,
        itemId: 1003,
        percent: 1,
        count: 13600000
    }, {
        id: 121,
        planetTypeId: 17,
        itemId: 1004,
        percent: 1,
        count: 2700000
    }, {
        id: 122,
        planetTypeId: 17,
        itemId: 1005,
        percent: 1,
        count: 5100000
    }, {
        id: 123,
        planetTypeId: 17,
        itemId: 1006,
        percent: 1,
        count: 17400000
    }, {
        id: 124,
        planetTypeId: 17,
        itemId: 1117,
        percent: 1.0,
        count: 18200000
    }, {
        id: 125,
        planetTypeId: 17,
        itemId: 1015,
        percent: 0.6,
        count: 10900000
    }, {
        id: 126,
        planetTypeId: 17,
        itemId: 1007,
        percent: 1.0,
        count: 18200,
        recover: 182
    }, {
        id: 127,
        planetTypeId: 18,
        itemId: 1001,
        percent: 1,
        count: 37800000
    }, {
        id: 128,
        planetTypeId: 18,
        itemId: 1002,
        percent: 1,
        count: 1900000
    }, {
        id: 129,
        planetTypeId: 18,
        itemId: 1004,
        percent: 1,
        count: 3400000
    }, {
        id: 130,
        planetTypeId: 18,
        itemId: 1006,
        percent: 1,
        count: 1400000
    }, {
        id: 131,
        planetTypeId: 18,
        itemId: 1117,
        percent: 0.7,
        count: 3300000
    }, {
        id: 132,
        planetTypeId: 18,
        itemId: 1014,
        percent: 1,
        count: 22500000
    }, {
        id: 133,
        planetTypeId: 18,
        itemId: 1007,
        percent: 1.0,
        count: 3300,
        recover: 33
    }, {
        id: 134,
        planetTypeId: 19,
        itemId: 1001,
        percent: 1,
        count: 13900000
    }, {
        id: 135,
        planetTypeId: 19,
        itemId: 1002,
        percent: 1,
        count: 1900000
    }, {
        id: 136,
        planetTypeId: 19,
        itemId: 1003,
        percent: 1,
        count: 4600000
    }, {
        id: 137,
        planetTypeId: 19,
        itemId: 1004,
        percent: 1,
        count: 14500000
    }, {
        id: 138,
        planetTypeId: 19,
        itemId: 1005,
        percent: 1,
        count: 3400000
    }, {
        id: 139,
        planetTypeId: 19,
        itemId: 1006,
        percent: 1,
        count: 200000
    }, {
        id: 140,
        planetTypeId: 19,
        itemId: 1007,
        percent: 1.0,
        count: 26900000
    }, {
        id: 141,
        planetTypeId: 19,
        itemId: 1012,
        percent: 1.0,
        count: 24000000
    }, {
        id: 142,
        planetTypeId: 19,
        itemId: 1014,
        percent: 0.4,
        count: 9000000
    }, {
        id: 143,
        planetTypeId: 20,
        itemId: 1001,
        percent: 1,
        count: 9500000
    }, {
        id: 144,
        planetTypeId: 20,
        itemId: 1002,
        percent: 1,
        count: 2100000
    }, {
        id: 145,
        planetTypeId: 20,
        itemId: 1003,
        percent: 1,
        count: 19400000
    }, {
        id: 146,
        planetTypeId: 20,
        itemId: 1004,
        percent: 1,
        count: 2400000
    }, {
        id: 147,
        planetTypeId: 20,
        itemId: 1005,
        percent: 1,
        count: 3000000
    }, {
        id: 148,
        planetTypeId: 20,
        itemId: 1006,
        percent: 1,
        count: 26100000
    }, {
        id: 149,
        planetTypeId: 20,
        itemId: 1013,
        percent: 0.5,
        count: 12300000
    }, {
        id: 150,
        planetTypeId: 20,
        itemId: 1117,
        percent: 1.0,
        count: 12300000
    }, {
        id: 151,
        planetTypeId: 20,
        itemId: 1015,
        percent: 0.5,
        count: 9400000
    }, {
        id: 152,
        planetTypeId: 21,
        itemId: 1120,
        percent: 1,
        count: 10000,
        recover: 2
    }, {
        id: 153,
        planetTypeId: 21,
        itemId: 1121,
        percent: 1,
        count: 10000,
        recover: 0.2
    }, {
        id: 154,
        planetTypeId: 22,
        itemId: 1120,
        percent: 1,
        count: 10000,
        recover: 2
    }, {
        id: 155,
        planetTypeId: 22,
        itemId: 1007,
        percent: 1,
        count: 10000,
        recover: 1
    }
]